@Echo off SETLOCAL REM script for adding metadata and art to m4a REM SCRIPT WILL NOT RUN IF ANY OF THE METADATA FILES ARE EMPTY rem mainly using MP3 ID3v2 tags rem date not year https://wiki.multimedia.cx/index.php/FFmpeg_Metadata rem author is a quicktime tag for %%f in (*.m4a) do ( for %%M in ([AlbumArtist] [artist] [composer] [Comment] [GENRE] [URLauthor] [year]) do ( echo %%M if NOT exist ".\%%~nf %%~M.txt" copy NUL ".\%%~nf %%~M.txt" ) FOR /f "tokens=* delims=," %%A in ('type "%%~nf [AlbumArtist].txt"') do ( FOR /f "tokens=* delims=," %%a in ('type "%%~nf [artist].txt"') do ( FOR /f "tokens=* delims=," %%c in ('type "%%~nf [composer].txt"') do ( FOR /f "tokens=* delims=," %%C in ('type "%%~nf [Comment].txt"') do ( FOR /f "tokens=* delims=," %%G in ('type "%%~nf [GENRE].txt"') do ( FOR /f "tokens=* delims=," %%U in ('type "%%~nf [URLauthor].txt"') do ( FOR /f "tokens=* delims=," %%y in ('type "%%~nf [year].txt"') do ( ffmpeg -i "%%~nf.m4a" -i "%%~nf.png" -map 0 -map 1 -c copy -disposition:v:0 attached_pic -metadata title="%%~nf" -metadata composer="%%c" -metadata artist="%%a" -metadata author="%%u" -metadata album_artist="%%A" -metadata genre="%%G" -metadata comment="%%C" -metadata author_url="%%U" -id3v2_version 3 -metadata:s:v title="Album cover" -metadata:s:v comment="Cover (front)" -metadata date=%%y "%%~nf(metacoded).m4a" ) ) ) ) ) ) ) )